﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using nyxwin.Common.Silverlight.Utils;
using nyxwin.Main.ViewModel.SubModels;

namespace nyxwin.Main.Utils
{
    public class MailTemplateSelector : DataTemplateSelector
    {
        public DataTemplate ToTemplate { get; set; }
        public DataTemplate FromTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            MailModel mm = item as MailModel;

            if (mm != null)
            {
                if (mm.RawDirection == "to")
                    return ToTemplate;
                else
                    return FromTemplate;
            }
            
            return base.SelectTemplate(item, container);
        }
    }
}
